﻿using Cudafy;
using Cudafy.Host;
using Lights.Types;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Lights.Processing
{
    public class Histogram
    {
        #region Properties
        public int[] Luminance { get; private set; }
        public int[] Red { get; private set; }
        public int[] Green { get; private set; }
        public int[] Blue { get; private set; }
        #endregion

        public Histogram(int[] luminance, int[] red, int[] green, int[] blue)
        {
            this.Luminance = luminance;
            this.Red = red;
            this.Green = green;
            this.Blue = blue;
        }

            //int length = src.Length / 4;
            //int[] luminance = new int[256];
            //int[] red = new int[256];
            //int[] green = new int[256];
            //int[] blue = new int[256];

            //Parallel.For(0, length, (i) =>
            //{
            //    int x = i * 4;
            //    Interlocked.Increment(ref luminance[(int)(0.3 * src[x + 2] + 0.59 * src[x+1] + 0.11 * src[x])]);
            //    Interlocked.Increment(ref red[src[x + 2]]);
            //    Interlocked.Increment(ref green[src[x + 1]]);
            //    Interlocked.Increment(ref blue[src[x]]);
            //});
            //return new Histogram(luminance, red, green, blue);
    }
}
